#!usr/bin/env python3
#用python把数据写入二进制文件被AS3读取
import struct

msg = bytes("这是python数据 你好吗".encode("utf8"))
fmt = "ii{0}s".format(len(msg))
pk = struct.pack(fmt,2008,3008,msg)
print("pk",pk,type(pk))
with open("data.byt","wb") as f:
    f.write(pk)


with  open("data.byt","rb") as f:
    byt = f.read()
    print("fmt",fmt)
    print(struct.unpack(fmt,byt))